package com.joolun.system.service.impl;

import java.util.List;

import com.joolun.common.corp.TenantContext;
import com.joolun.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.stereotype.Service;
import com.joolun.system.mapper.EduCourseHourMapper;
import com.joolun.system.domain.EduCourseHour;
import com.joolun.system.service.IEduCourseHourService;

/**
 * 课程课时Service业务层处理
 * 
 * @author joolun
 * @date 2025-02-27
 */
@Service
public class EduCourseHourServiceImpl extends  ServiceImpl<EduCourseHourMapper, EduCourseHour> implements IEduCourseHourService
{
    @Autowired
    private EduCourseHourMapper eduCourseHourMapper;

    /**
     * 查询课程课时
     * 
     * @param hourId 课程课时主键
     * @return 课程课时
     */
    @Override
    public EduCourseHour selectEduCourseHourByHourId(Long hourId)
    {
        return eduCourseHourMapper.selectEduCourseHourByHourId(hourId);
    }

    /**
     * 查询课程课时列表
     * 
     * @param eduCourseHour 课程课时
     * @return 课程课时
     */
    @Override
    public List<EduCourseHour> selectEduCourseHourList(EduCourseHour eduCourseHour)
    {
        // 添加主体id
        eduCourseHour.setCorpId(TenantContext.getTenantId());
        return eduCourseHourMapper.selectEduCourseHourList(eduCourseHour);
    }

    /**
     * 新增课程课时
     * 
     * @param eduCourseHour 课程课时
     * @return 结果
     */
    @Override
    public int insertEduCourseHour(EduCourseHour eduCourseHour)
    {
        // 添加主体id
        eduCourseHour.setCorpId(TenantContext.getTenantId());
        eduCourseHour.setCreateTime(DateUtils.getNowDate());
        return eduCourseHourMapper.insertEduCourseHour(eduCourseHour);
    }

    /**
     * 修改课程课时
     * 
     * @param eduCourseHour 课程课时
     * @return 结果
     */
    @Override
    public int updateEduCourseHour(EduCourseHour eduCourseHour)
    {
        eduCourseHour.setUpdateTime(DateUtils.getNowDate());
        return eduCourseHourMapper.updateEduCourseHour(eduCourseHour);
    }

    /**
     * 批量删除课程课时
     * 
     * @param hourIds 需要删除的课程课时主键
     * @return 结果
     */
    @Override
    public int deleteEduCourseHourByHourIds(Long[] hourIds)
    {
        return eduCourseHourMapper.deleteEduCourseHourByHourIds(hourIds);
    }

    /**
     * 删除课程课时信息
     * 
     * @param hourId 课程课时主键
     * @return 结果
     */
    @Override
    public int deleteEduCourseHourByHourId(Long hourId)
    {
        return eduCourseHourMapper.deleteEduCourseHourByHourId(hourId);
    }
}
